package com.gw.vip.server.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gw.vip.server.po.HisTransLock;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;

/**
 * @author GW
 * @description
 * @since 2022-05-10
 */
public interface HisTransLockMapper extends BaseMapper<HisTransLock> {
    /**
     * 根据清算日期查询交易数量
     * @param clearDate
     * @return
     */
    @Select("SELECT COUNT(1) FROM his_trans_lock WHERE clear_date=#{clearDate}")
    int countByClearDate(LocalDate clearDate);

    /**
     * tmpTransAcc表转hisTransAcc
     * @param clearDate
     */
    @Insert("INSERT INTO his_trans_lock (SELECT * FROM tmp_trans_lock WHERE clear_date=#{clearDate})")
    void tmpTransAccLockToHis(LocalDate clearDate);
}
